package com.k2data.k2app.rest;

import com.k2data.k2app.domain.deviceRest.Event;
import com.k2data.k2app.rest.domain.RectList;
import com.k2data.k2app.rest.domain.RectObject;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.*;

/**
 * Created by clb on 17-6-15.
 */
@Component
@FeignClient(value = "K2ALPHA-DEVICE-V1", fallback = DeviceClientFallback.class)
public interface DeviceClient{
	@RequestMapping(method = RequestMethod.GET, value = "/devices")
	RectList getAllDevices(@RequestParam("pageNum") Integer pageNum, @RequestParam("pageSize") Integer pageSize, @RequestParam("deviceNo")String deviceNo);

	@RequestMapping(method = RequestMethod.GET, value = "/devices/{id}")
	RectObject getDeviceById(@PathVariable("id") Long id);

	@RequestMapping(method = RequestMethod.PUT, value = "/devices/{id}")
	RectObject updateDevice(@PathVariable("id") Long id,Object device);

	@RequestMapping(method = RequestMethod.GET, value = "/templates/devices")
	RectList getTemplateDeviceById(@RequestParam("id") Long id);

	@RequestMapping(method = RequestMethod.GET, value = "/templates/monitors/points/{id}")
	RectList getTemplatePointById(@PathVariable("id") Long id);

	@RequestMapping(method = RequestMethod.GET, value = "/devices/points/{id}")
	RectObject getDevicePointById(@PathVariable("id") Long id);

	@RequestMapping(method = RequestMethod.GET, value = "/devices/points")
	RectList getDevicePoint(@RequestParam("root_id") Long root_id,
							@RequestParam("monitorPointId") Long monitorPointId,
							@RequestParam("channelId") Integer channelId,
							@RequestParam("isGroup") boolean isGroup);

	@RequestMapping(method = RequestMethod.GET, value = "/devices/points")
	RectObject getDevicePointGroup(@RequestParam("root_id") Long root_id,
								   @RequestParam("monitorPointId") Long monitorPointId,
								   @RequestParam("channelId") Integer channelId,
								   @RequestParam("isGroup") boolean isGroup);

	@RequestMapping(method = RequestMethod.GET, value = "/templates/monitors/variables/{id}")
	RectList getTemplateVariablesById(@PathVariable("id") Long id);

	@RequestMapping(method = RequestMethod.GET, value = "/devices/monitors/variables/{id}")
	RectList getDeviceVariablesById(@PathVariable("id") Long id);

	@RequestMapping(method = RequestMethod.GET, value = "/customers/{id}")
	RectObject getCustomerById(@PathVariable("id") Long id);

	@RequestMapping(method = RequestMethod.POST, value = "/events1/maintenance")
	RectObject addEvent(@RequestBody Event event);

	@RequestMapping(method = RequestMethod.PUT, value = "/devices/status")
	void changeStatus(@RequestParam("deviceNo") String deviceNo,
					  @RequestParam("status") String status);
}
